# 导入flask类
from flask import Flask, request
from werkzeug.routing import BaseConverter
import json

app = Flask(__name__)


@app.route("/")
def index():
    return f"<h1>参数传递</h1>"


# header 头部信息,cookies
@app.route("/other",methods = ['GET','POST'])
def other():
    print(request.url_root,request.path,request.base_url,request.url)
    # print(request.headers)
    print(request.headers.get("Accept-Encoding"))
    print(request.method)
    print(request.cookies.get("uid"))
    # 将请求头转换为字符串
    return str(request.headers)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000, debug=True)
